package muview;

import java.sql.Date;
import java.util.Calendar;
import java.util.List;

import com.cloudgarden.resource.SWTResourceManager;

import mumethod.*;
import muobject.*;

import org.eclipse.swt.SWT;
import org.eclipse.swt.events.SelectionAdapter;
import org.eclipse.swt.events.SelectionEvent;
import org.eclipse.swt.graphics.Color;
import org.eclipse.swt.graphics.Image;
import org.eclipse.swt.graphics.ImageData;
import org.eclipse.swt.layout.FillLayout;
import org.eclipse.swt.layout.FormAttachment;
import org.eclipse.swt.layout.FormData;
import org.eclipse.swt.layout.FormLayout;
import org.eclipse.swt.widgets.Button;
import org.eclipse.swt.widgets.Composite;
import org.eclipse.swt.widgets.Control;
import org.eclipse.swt.widgets.FileDialog;
import org.eclipse.swt.widgets.Group;
import org.eclipse.swt.widgets.Label;
import org.eclipse.swt.widgets.Shell;
import org.eclipse.swt.widgets.Text;
import org.springframework.context.ApplicationContext;


/**
* This code was edited or generated using CloudGarden's Jigloo
* SWT/Swing GUI Builder, which is free for non-commercial
* use. If Jigloo is being used commercially (ie, by a corporation,
* company or business for any purpose whatever) then you
* should purchase a license for each developer using Jigloo.
* Please visit www.cloudgarden.com for details.
* Use of Jigloo implies acceptance of these licensing terms.
* A COMMERCIAL LICENSE HAS NOT BEEN PURCHASED FOR
* THIS MACHINE, SO JIGLOO OR THIS CODE CANNOT BE USED
* LEGALLY FOR ANY CORPORATE OR COMMERCIAL PURPOSE.
*/
class TeacherSchoolSetting extends Composite {

	{
		//Register as a resource user - SWTResourceManager will
		//handle the obtaining and disposing of resources
		SWTResourceManager.registerResourceUser(this);
	}
	
	
	private Label lab_sno;
	private Label lab_tname;
	private Label lab_temail;
	private Label lab_ttel;
	private Label lab_registerdate;
	private Text txt_registerdate;
	private Text txt_president;
	private Text txt_ttel;
	private Text txt_sfax;
	private Text txt_tname;
	private Text txt_saddress;
	private Text txt_stel;
	private Text txt_ename;
	private Text txt_cname;
	private Text txt_sno;
	private Label lab_president;
	private Label lab_steacher;
	private Label lab_sfax;
	private Label lab_stel;
	private Label lab_saddress;
	private Label lab_daytype;
	private Label lab_publictype;
	private Label lab_ename;
	private Label lab_scname;
	private Button but_calendar;
	private Button but_print;
	private Label lab_Message;
	private Label lab_pic1;
	private Button rbut_daytype_morning;
	private Button rbut_daytype_afternoon;
	private Button rbut_daytype_all;
	private Group gp_daytype;
	private Group gp_publictype;
	private Button rbut_publictype_private;
	private Button rbut_publictype_public;
	private Text txt_email;
	private Button but_edit;
	private Button but_account;
	private Label lab_schoolInformation;
	
	private School school;
	private ApplicationContext springConnector;
	private static String imagePath;
	private AccessSchools getSchools;
	private ExportFunction sExcelExport;
	private String error;
	
	public void Init(SystemProperty systemProperty) {
		try {
			System.setProperty("file.encoding", "big5");
			springConnector = systemProperty.getSpringConnector();
			imagePath = systemProperty.getImagePath();
			getSchools = (AccessSchools) springConnector.getBean("AccessSchoolsService");
			sExcelExport = new ExportFunction();
			school = getSchools.getTopClasses();
			error = "";
		} catch (Exception e) {
			error = "系統設定錯誤!";
			Calendar cal = Calendar.getInstance();
			school = new School(0, "", "", "", "", "", "", "", "", "", "", "",
					"", "", new Date(cal.getTime().getTime()), new Date(cal
							.getTime().getTime()), new Date(cal.getTime()
							.getTime()));
		}
	}

	public TeacherSchoolSetting(Composite c, final Shell shell, final SystemProperty systemProperty, final Label lab_titleschoolname) {
		super(c, SWT.BORDER);
		Init(systemProperty);
		
		FormLayout CompositeFormLayout = new FormLayout();
		this.setLayout(CompositeFormLayout);
		this.setSize(990, 507);
		{
			FormData but_calendarLData = new FormData();
			but_calendarLData.left =  new FormAttachment(0, 1000, 409);
			but_calendarLData.top =  new FormAttachment(0, 1000, 473);
			but_calendarLData.width = 20;
			but_calendarLData.height = 20;
			but_calendar = new Button(this, SWT.PUSH | SWT.CENTER);
			but_calendar.setLayoutData(but_calendarLData);
			ImageData date = new ImageData(imagePath + "calendar.png");
			date.scaledTo(10, 10);
			Image image = new Image(shell.getDisplay(), date);
			but_calendar.setImage(image);
			but_calendar.addSelectionListener(new SelectionAdapter() {
				public void widgetSelected(SelectionEvent e) {
					DialogCalendar dialogCalendar = new DialogCalendar(shell);
					Object day = dialogCalendar.open(0,0);
					txt_registerdate.setText(day != null ? day.toString() : txt_registerdate.getText());
				}
			});
		}
		{
			FormData lab_MessageLData = new FormData();
			lab_MessageLData.left = new FormAttachment(0, 1000, 621);
			lab_MessageLData.top = new FormAttachment(0, 1000, 5);
			lab_MessageLData.width = 357;
			lab_MessageLData.height = 30;
			lab_Message = new Label(this, SWT.RIGHT);
			lab_Message.setForeground(new Color(this.getDisplay(), 255, 0, 0));
			lab_Message.setLayoutData(lab_MessageLData);
			lab_Message.setFont(SWTResourceManager.getFont("Tahoma", 14, 0,
					false, false));
			if (!error.equals(""))
				lab_Message.setText(error);
		}
		
		{
			FormData lab_pic1LData = new FormData();
			lab_pic1LData.left =  new FormAttachment(0, 1000, 767);
			lab_pic1LData.top =  new FormAttachment(0, 1000, 9);
			lab_pic1LData.width = 192;
			lab_pic1LData.height = 250;
			lab_pic1 = new Label(this, SWT.RIGHT);
			lab_pic1.setForeground(new Color(this.getDisplay(), 255, 0, 0));
			lab_pic1.setLayoutData(lab_pic1LData);
			ImageData date = new ImageData(imagePath + "pic1.png");
			date.scaledTo(130, 200);
			Image image = new Image(shell.getDisplay(), date);
			lab_pic1.setImage (image);
			lab_pic1.setFont(SWTResourceManager.getFont("Tahoma", 14, 0,
					false, false));
		}
		{
			gp_publictype = new Group(this, SWT.NONE);
			FillLayout gp_publictypeLayout = new FillLayout(
					org.eclipse.swt.SWT.HORIZONTAL);
			FormData gp_publictypeLData = new FormData();
			gp_publictypeLData.left = new FormAttachment(0, 1000, 256);
			gp_publictypeLData.top = new FormAttachment(0, 1000, 184);
			gp_publictypeLData.width = 129;
			gp_publictypeLData.height = 15;
			gp_publictype.setLayoutData(gp_publictypeLData);
			gp_publictype.setLayout(gp_publictypeLayout);
			{
				rbut_publictype_public = new Button(gp_publictype, SWT.RADIO
						| SWT.LEFT);
				rbut_publictype_public.setText("1. \u516c\u7acb");
				rbut_publictype_public.setFont(SWTResourceManager.getFont(
						"Tahoma", 9, 0, false, false));
			}
			{
				rbut_publictype_private = new Button(gp_publictype, SWT.RADIO
						| SWT.LEFT);
				rbut_publictype_private.setText("2. \u79c1\u7acb");
				rbut_publictype_private.setFont(SWTResourceManager.getFont(
						"Tahoma", 9, 0, false, false));
			}
			if (school.getPublictype().equals("Public")) {
				rbut_publictype_public.setSelection(true);
			} else if (school.getPublictype().equals("Private")) {
				rbut_publictype_private.setSelection(true);
			}
		}
		{
			gp_daytype = new Group(this, SWT.NONE);
			FillLayout gp_daytypeLayout = new FillLayout(
					org.eclipse.swt.SWT.HORIZONTAL);
			gp_daytype.setLayout(gp_daytypeLayout);
			FormData daytypeLData = new FormData();
			daytypeLData.left = new FormAttachment(0, 1000, 256);
			daytypeLData.top = new FormAttachment(0, 1000, 223);
			daytypeLData.width = 197;
			daytypeLData.height = 15;
			gp_daytype.setLayoutData(daytypeLData);
			{
				rbut_daytype_all = new Button(gp_daytype, SWT.RADIO | SWT.LEFT);
				rbut_daytype_all.setText("1. \u5168\u65e5");
				rbut_daytype_all.setFont(SWTResourceManager.getFont("Tahoma",
						9, 0, false, false));
			}
			{
				rbut_daytype_morning = new Button(gp_daytype, SWT.RADIO
						| SWT.LEFT);
				rbut_daytype_morning.setText("2. \u4e0a\u5348");
				rbut_daytype_morning.setFont(SWTResourceManager.getFont(
						"Tahoma", 9, 0, false, false));
			}
			{
				rbut_daytype_afternoon = new Button(gp_daytype, SWT.RADIO
						| SWT.LEFT);
				rbut_daytype_afternoon.setText("3. \u4e0b\u5348");
				rbut_daytype_afternoon.setFont(SWTResourceManager.getFont(
						"Tahoma", 9, 0, false, false));
			}
			if (school.getDaytype().equals("All")) {
				rbut_daytype_all.setSelection(true);
			} else if (school.getDaytype().equals("Morning")) {
				rbut_daytype_morning.setSelection(true);
			} else if (school.getDaytype().equals("Afternoon")) {
				rbut_daytype_afternoon.setSelection(true);
			}
		}
		{
			FormData txt_snoLData = new FormData(129, 25);
			txt_snoLData.left = new FormAttachment(0, 1000, 256);
			txt_snoLData.top = new FormAttachment(0, 1000, 70);
			txt_snoLData.width = 60;
			txt_snoLData.height = 19;
			txt_sno = new Text(this, SWT.BORDER);
			txt_sno.setLayoutData(txt_snoLData);
			txt_sno.setSize(135, 25);
			txt_sno.setText(school.getSno());
		}
		{
			txt_cname = new Text(this, SWT.BORDER);
			FormData text1LData = new FormData(117, 19);
			text1LData.width = 280;
			text1LData.height = 19;
			text1LData.left = new FormAttachment(0, 1000, 256);
			text1LData.top = new FormAttachment(0, 1000, 110);
			txt_cname.setLayoutData(text1LData);
			txt_cname.setSize(135, 25);
			txt_cname.setText(school.getCname());
		}
		{
			txt_ename = new Text(this, SWT.BORDER);
			FormData text1LData1 = new FormData();
			text1LData1.width = 280;
			text1LData1.height = 19;
			text1LData1.left = new FormAttachment(0, 1000, 256);
			text1LData1.top = new FormAttachment(0, 1000, 150);
			txt_ename.setLayoutData(text1LData1);
			txt_ename.setSize(135, 25);
			txt_ename.setText(school.getEname());
		}
		{
			txt_stel = new Text(this, SWT.BORDER);
			FormData text1LData4 = new FormData(135, 19);
			text1LData4.width = 135;
			text1LData4.height = 19;
			text1LData4.left = new FormAttachment(0, 1000, 256);
			text1LData4.top = new FormAttachment(0, 1000, 270);
			txt_stel.setLayoutData(text1LData4);
			txt_stel.setSize(135, 25);
			txt_stel.setText(school.getTel());
		}
		{
			txt_saddress = new Text(this, SWT.BORDER);
			FormData text1LData5 = new FormData(135, 19);
			text1LData5.width = 135;
			text1LData5.height = 19;
			text1LData5.left = new FormAttachment(0, 1000, 256);
			text1LData5.top = new FormAttachment(0, 1000, 310);
			txt_saddress.setLayoutData(text1LData5);
			txt_saddress.setSize(135, 25);
			txt_saddress.setText(school.getAddress());
		}
		{
			txt_tname = new Text(this, SWT.BORDER);
			FormData text1LData6 = new FormData();
			text1LData6.width = 135;
			text1LData6.height = 19;
			text1LData6.left = new FormAttachment(0, 1000, 256);
			text1LData6.top = new FormAttachment(0, 1000, 350);
			txt_tname.setLayoutData(text1LData6);
			txt_tname.setText(school.getTname());
		}
		{
			txt_sfax = new Text(this, SWT.BORDER);
			FormData text1LData7 = new FormData();
			text1LData7.left = new FormAttachment(0, 1000, 561);
			text1LData7.top = new FormAttachment(0, 1000, 270);
			text1LData7.width = 135;
			text1LData7.height = 19;
			txt_sfax.setLayoutData(text1LData7);
			txt_sfax.setText(school.getFax());
		}
		{
			txt_ttel = new Text(this, SWT.BORDER);
			FormData text1LData8 = new FormData();
			text1LData8.left = new FormAttachment(0, 1000, 561);
			text1LData8.top = new FormAttachment(0, 1000, 350);
			text1LData8.width = 135;
			text1LData8.height = 19;
			txt_ttel.setLayoutData(text1LData8);
			txt_ttel.setText(school.getTtel());
		}
		{
			txt_email = new Text(this, SWT.BORDER);
			FormData text1LData11 = new FormData();
			text1LData11.left = new FormAttachment(0, 1000, 561);
			text1LData11.top = new FormAttachment(0, 1000, 387);
			text1LData11.width = 135;
			text1LData11.height = 19;
			txt_email.setLayoutData(text1LData11);
			txt_email.setText(school.getTemail());
		}
		{
			txt_president = new Text(this, SWT.BORDER);
			FormData text1LData9 = new FormData();
			text1LData9.left = new FormAttachment(0, 1000, 256);
			text1LData9.top = new FormAttachment(0, 1000, 430);
			text1LData9.width = 135;
			text1LData9.height = 19;
			txt_president.setLayoutData(text1LData9);
			txt_president.setText(school.getPresident());
		}
		{
			txt_registerdate = new Text(this, SWT.BORDER);
			FormData text1LData10 = new FormData();
			text1LData10.left = new FormAttachment(0, 1000, 256);
			text1LData10.top = new FormAttachment(0, 1000, 470);
			text1LData10.width = 135;
			text1LData10.height = 19;
			txt_registerdate.setLayoutData(text1LData10);
			txt_registerdate.setText(school.getRegisterdate().toString());
		}
		{
			lab_scname = new Label(this, SWT.NONE);
			FormData lab_scnameLData = new FormData();
			lab_scnameLData.left = new FormAttachment(0, 1000, 45);
			lab_scnameLData.top = new FormAttachment(0, 1000, 110);
			lab_scnameLData.width = 135;
			lab_scnameLData.height = 25;
			lab_scname.setLayoutData(lab_scnameLData);
			lab_scname.setText("\u5b78\u6821\u4e2d\u6587\u540d\u7a31 :");
			lab_scname.setFont(SWTResourceManager.getFont("Tahoma", 14, 1, false, false));
		}
		{
			lab_schoolInformation = new Label(this, SWT.NONE);
			FormData lab_schoolInformationLData = new FormData();
			lab_schoolInformationLData.left = new FormAttachment(0, 1000, 5);
			lab_schoolInformationLData.top = new FormAttachment(0, 1000, 5);
			lab_schoolInformationLData.width = 248;
			lab_schoolInformationLData.height = 55;
			lab_schoolInformation.setLayoutData(lab_schoolInformationLData);
			lab_schoolInformation
					.setText("\u5b78\u6821\u8cc7\u6599\u8a2d\u5b9a");
			lab_schoolInformation.setFont(SWTResourceManager.getFont("Tahoma", 26, 1, false, false));
		}
		{
			lab_sno = new Label(this, SWT.NONE);
			FormData lab_snoLData = new FormData(135, 25);
			lab_snoLData.left = new FormAttachment(0, 1000, 45);
			lab_snoLData.top = new FormAttachment(0, 1000, 70);
			lab_snoLData.width = 135;
			lab_snoLData.height = 25;
			lab_sno.setLayoutData(lab_snoLData);
			lab_sno.setText("\u5b78\u90e8\u7de8\u865f :");
			lab_sno.setFont(SWTResourceManager.getFont("Tahoma", 14, 1, false, false));
			lab_sno.setSize(135, 25);
		}
		{
			lab_ename = new Label(this, SWT.NONE);
			lab_ename.setText("\u5b78\u6821\u5916\u6587\u540d\u7a31 :");
			FormData label1LData = new FormData();
			label1LData.left = new FormAttachment(0, 1000, 45);
			label1LData.top = new FormAttachment(0, 1000, 150);
			label1LData.width = 135;
			label1LData.height = 25;
			lab_ename.setLayoutData(label1LData);
			lab_ename.setFont(SWTResourceManager.getFont("Tahoma", 14, 1, false, false));
		}
		{
			lab_publictype = new Label(this, SWT.NONE);
			lab_publictype.setText("\u5b78\u6821\u985e\u5225 :");
			FormData label1LData1 = new FormData();
			label1LData1.left = new FormAttachment(0, 1000, 45);
			label1LData1.top = new FormAttachment(0, 1000, 190);
			label1LData1.width = 135;
			label1LData1.height = 25;
			lab_publictype.setLayoutData(label1LData1);
			lab_publictype.setFont(SWTResourceManager.getFont("Tahoma", 14, 1, false, false));
		}
		{
			lab_daytype = new Label(this, SWT.NONE);
			lab_daytype.setText("\u6388\u8ab2\u5236 :");
			FormData label1LData2 = new FormData();
			label1LData2.left = new FormAttachment(0, 1000, 45);
			label1LData2.top = new FormAttachment(0, 1000, 230);
			label1LData2.width = 135;
			label1LData2.height = 25;
			lab_daytype.setLayoutData(label1LData2);
			lab_daytype.setFont(SWTResourceManager.getFont("Tahoma", 14, 1, false, false));
		}
		{
			lab_stel = new Label(this, SWT.NONE);
			lab_stel.setText("\u5b78\u6821\u96fb\u8a71 :");
			FormData label1LData4 = new FormData();
			label1LData4.left = new FormAttachment(0, 1000, 45);
			label1LData4.top = new FormAttachment(0, 1000, 270);
			label1LData4.width = 135;
			label1LData4.height = 25;
			lab_stel.setLayoutData(label1LData4);
			lab_stel.setFont(SWTResourceManager.getFont("Tahoma", 14, 1, false, false));
		}
		{
			lab_saddress = new Label(this, SWT.NONE);
			lab_saddress.setText("\u5b78\u6821\u5730\u5740 :");
			FormData label1LData3 = new FormData();
			label1LData3.left = new FormAttachment(0, 1000, 45);
			label1LData3.top = new FormAttachment(0, 1000, 310);
			label1LData3.width = 135;
			label1LData3.height = 25;
			lab_saddress.setLayoutData(label1LData3);
			lab_saddress.setFont(SWTResourceManager.getFont("Tahoma", 14, 1, false, false));
		}
		{
			lab_sfax = new Label(this, SWT.NONE);
			lab_sfax.setText("\u5b78\u6821\u50b3\u771f :");
			FormData label1LData5 = new FormData();
			label1LData5.left = new FormAttachment(0, 1000, 461);
			label1LData5.top = new FormAttachment(0, 1000, 270);
			label1LData5.width = 100;
			label1LData5.height = 25;
			lab_sfax.setLayoutData(label1LData5);
			lab_sfax.setFont(SWTResourceManager.getFont("Tahoma", 14, 1, false, false));
		}
		{
			lab_steacher = new Label(this, SWT.NONE);
			lab_steacher.setText("\u8ca0\u8cac\u8001\u5e2b :");
			FormData label1LData6 = new FormData();
			label1LData6.left = new FormAttachment(0, 1000, 45);
			label1LData6.top = new FormAttachment(0, 1000, 350);
			label1LData6.width = 135;
			label1LData6.height = 25;
			lab_steacher.setLayoutData(label1LData6);
			lab_steacher.setFont(SWTResourceManager.getFont("Tahoma", 14, 1, false, false));
		}
		{
			lab_tname = new Label(this, SWT.NONE);
			lab_tname.setText("\u59d3\u540d :");
			FormData label1LData7 = new FormData();
			label1LData7.left = new FormAttachment(0, 1000, 192);
			label1LData7.top = new FormAttachment(0, 1000, 350);
			label1LData7.width = 64;
			label1LData7.height = 25;
			lab_tname.setLayoutData(label1LData7);
			lab_tname.setFont(SWTResourceManager.getFont("Tahoma", 14, 1, false, false));
		}
		{
			lab_ttel = new Label(this, SWT.NONE);
			lab_ttel.setText("\u806f\u7d61\u96fb\u8a71 :");
			FormData label1LData8 = new FormData();
			label1LData8.left = new FormAttachment(0, 1000, 461);
			label1LData8.top = new FormAttachment(0, 1000, 350);
			label1LData8.width = 100;
			label1LData8.height = 25;
			lab_ttel.setLayoutData(label1LData8);
			lab_ttel.setFont(SWTResourceManager.getFont("Tahoma", 14, 1, false, false));
		}
		{
			lab_temail = new Label(this, SWT.NONE);
			lab_temail.setText("\u806f\u7d61\u96fb\u90f5 :");
			FormData label1LData9 = new FormData();
			label1LData9.left = new FormAttachment(0, 1000, 461);
			label1LData9.top = new FormAttachment(0, 1000, 387);
			label1LData9.width = 100;
			label1LData9.height = 25;
			lab_temail.setLayoutData(label1LData9);
			lab_temail.setFont(SWTResourceManager.getFont("Tahoma", 14, 1, false, false));
		}
		{
			lab_president = new Label(this, SWT.NONE);
			lab_president.setText("\u6821\u9577\u59d3\u540d :");
			FormData label1LData10 = new FormData();
			label1LData10.left = new FormAttachment(0, 1000, 45);
			label1LData10.top = new FormAttachment(0, 1000, 430);
			label1LData10.width = 135;
			label1LData10.height = 25;
			lab_president.setLayoutData(label1LData10);
			lab_president.setFont(SWTResourceManager.getFont("Tahoma", 14, 1, false, false));
		}
		{
			lab_registerdate = new Label(this, SWT.NONE);
			lab_registerdate.setText("\u8a3b\u518a\u65e5\u671f :");
			FormData label1LData11 = new FormData();
			label1LData11.left = new FormAttachment(0, 1000, 45);
			label1LData11.top = new FormAttachment(0, 1000, 470);
			label1LData11.width = 135;
			label1LData11.height = 25;
			lab_registerdate.setLayoutData(label1LData11);
			lab_registerdate.setFont(SWTResourceManager.getFont("Tahoma", 14, 1, false, false));
		}
		{
			but_account = new Button(this, SWT.PUSH | SWT.CENTER);
			FormData but_accountLData = new FormData();
			but_accountLData.left =  new FormAttachment(0, 1000, 820);
			but_accountLData.top =  new FormAttachment(0, 1000, 270);
			but_accountLData.width = 145;
			but_accountLData.height = 65;
			but_account.setLayoutData(but_accountLData);
			but_account.setText("\u4fee\u6539\u5e33\u865f");
			but_account.setFont(SWTResourceManager.getFont("Tahoma", 22, 1, false, false));
			but_account.addSelectionListener(new SelectionAdapter() {
				public void widgetSelected(SelectionEvent e) {
					DialogEditAccount dialogEditAccount = new DialogEditAccount(shell, springConnector);
					dialogEditAccount.open();
				}
			});
		}
		{
			but_edit = new Button(this, SWT.PUSH | SWT.CENTER);
			FormData but_editLData = new FormData();
			but_editLData.left =  new FormAttachment(0, 1000, 820);
			but_editLData.top =  new FormAttachment(0, 1000, 430);
			but_editLData.width = 145;
			but_editLData.height = 65;
			but_edit.setLayoutData(but_editLData);
			but_edit.setText("\u4fee\u6539\u5132\u5b58");
			but_edit.setFont(SWTResourceManager.getFont("Tahoma", 22, 1, false, false));
			but_edit.addSelectionListener(new SelectionAdapter() {
				public void widgetSelected(SelectionEvent e) {
					String publictype = (rbut_publictype_public.getSelection()) ? "Public"
							: "Private";
					String daytype = (rbut_daytype_all.getSelection()) ? "All"
							: (rbut_daytype_morning.getSelection()) ? "Morning"
									: "Afternoon";
					Date updateDate = new Date(new java.util.Date().getTime());
					school = new School(school.getScid(), txt_sno.getText(),
							txt_cname.getText(), txt_ename.getText(),
							publictype, school.getGrade(), daytype, txt_stel
									.getText(), txt_sfax.getText(),
							txt_saddress.getText(), txt_tname.getText(),
							txt_ttel.getText(), txt_email.getText(),
							txt_president.getText(), Date
									.valueOf(txt_registerdate.getText()),
							school.getCreatedate(), updateDate);
					try {
						if (getSchools.updateSchools(school)) {
							lab_titleschoolname.setText(txt_cname.getText());
							DialogMessage.open(shell, "修改成功", "修改成功",
									SWT.ICON_INFORMATION);
						} else {
							DialogMessage.open(shell, "修改失敗", "修改失敗",
									SWT.ICON_INFORMATION);
						}
					} catch (Exception systemError) {
						DialogMessage.open(shell, "系統設定錯誤", "系統設定錯誤",
								SWT.ICON_ERROR);
					}
				}
			});
		}
		{
			but_print = new Button(this, SWT.PUSH | SWT.CENTER);
			but_print.setText("\u5132\u5b58\u532f\u51fa");
			FormData button1LData = new FormData();
			button1LData.left =  new FormAttachment(0, 1000, 820);
			button1LData.top =  new FormAttachment(0, 1000, 350);
			button1LData.width = 145;
			button1LData.height = 65;
			but_print.setLayoutData(button1LData);
			but_print.setFont(SWTResourceManager.getFont("Tahoma", 22, 1, false, false));
			but_print.addSelectionListener(new SelectionAdapter() {
				public void widgetSelected(SelectionEvent e) {
					String publictype = (rbut_publictype_public.getSelection()) ? "Public"
							: "Private";
					String daytype = (rbut_daytype_all.getSelection()) ? "All"
							: (rbut_daytype_morning.getSelection()) ? "Morning"
									: "Afternoon";
					Date updateDate = new Date(new java.util.Date().getTime());
					school = new School(school.getScid(), txt_sno.getText(),
							txt_cname.getText(), txt_ename.getText(),
							publictype, school.getGrade(), daytype, txt_stel
									.getText(), txt_sfax.getText(),
							txt_saddress.getText(), txt_tname.getText(),
							txt_ttel.getText(), txt_email.getText(),
							txt_president.getText(), Date
									.valueOf(txt_registerdate.getText()),
							school.getCreatedate(), updateDate);
					try {
						FileDialog fileDialog = new FileDialog(shell, SWT.SAVE);
						fileDialog.setText("Save");
						fileDialog.setFilterPath("C:/");
						fileDialog.setFileName("School.xls");
				        String[] filterExt = { "*.xls" };
				        fileDialog.setFilterExtensions(filterExt);
				        String distinationPath = fileDialog.open();
				        if (distinationPath != null){
						  if (getSchools.updateSchools(school)) {
							try {
								lab_titleschoolname.setText(txt_cname.getText());
								publictype = (rbut_publictype_public.getSelection()) ? "公立"
										: "私立";
								daytype = (rbut_daytype_all.getSelection()) ? "全日"
										: (rbut_daytype_morning.getSelection()) ? "上午"
												: "下午";
								List<String> columns = sExcelExport
										.ListColumns("學部編號 ", "學校中文名稱",
												"學校外文名稱", "學校類別 ", "學部", "授課制",
												"學校電話", "學校地址", "老師姓名", "老師電話",
												"老師電郵", "校長姓名", "註冊日期");
								List<String> values = sExcelExport.ListColumns(
										school.getSno(), school.getCname(),
										school.getEname(), publictype, school
												.getGrade(), daytype, school.getTel(),
										school.getAddress(), school.getTname(),
										school.getTtel(), school.getTemail(),
										school.getPresident(), String
												.valueOf(school
														.getRegisterdate()));
								sExcelExport.ExportSchoolVerticalExcel(columns, values, distinationPath);
								DialogMessage.open(shell, "修改及匯出成功", "修改及匯出成功",
										SWT.ICON_INFORMATION);
							} catch (Exception ex) {
								lab_titleschoolname.setText(txt_cname.getText());
								DialogMessage.open(shell, "修改成功,匯出失敗",
										"修改成功,匯出失敗", SWT.ICON_WARNING);
							}
						  } else {
							DialogMessage.open(shell, "修改及匯出失敗", "修改及匯出失敗",
									SWT.ICON_WARNING);
						  }
				        }
					} catch (Exception systemError) {
						DialogMessage.open(shell, "系統設定錯誤", "系統設定錯誤",
								SWT.ICON_ERROR);
					}
				}
			});
		}
	}
}
